from odoo import fields, models, api


class ProductTemplate(models.Model):
    _inherit = "product.template"

    # 预设BOM
    presets_bom_id = fields.Many2one('sb.presets.bom', 'Preset BOM', copy=False)

    def create_presets_wizard(self):
        return {
            'type': 'ir.actions.act_window',
            'res_model': 's.presets.bom.wizard',
            # 'res_id': res.id,
            'view_mode': 'form',
            'context': {'default_product_id': self.product_variant_id.id},
            'target': 'new',
        }
